package com.ruanjian.api.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;

/**
 * @author shkstart
 * @create 2022-11-15 11:15
 */
@Configuration
@EnableSwagger2
public class SpringFoxSwaggerConfig {

    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .pathMapping("/")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.ruanjian.api.controller"))
                .paths(PathSelectors.any())
                .build().apiInfo(new ApiInfoBuilder()
                        .title("项目名")
                        .description("软件大赛api文档---java")
                        .version("1.0")
                        .contact(new Contact("here","blog.csdn.net","1955504619@qq.com"))
                        .license("项目地址")
                        .licenseUrl("https://static-bcddeb84-44e8-4ee4-b390-e3c42fe77f17.bspapp.com")
                        .build());
    }

//    /**
//     * 配置基本信息
//     * @return
//     */
//    @Bean
//    public ApiInfo apiInfo() {
//        return new ApiInfoBuilder()
//                .title("Swagger Test App Restful API")
//                .description("swagger test app restful api")
//                .termsOfServiceUrl("https://github.com/geekxingyun")
//                .contact(new Contact("技术宅星云","https://xingyun.blog.csdn.net","fairy_xingyun@hotmail.com"))
//                .version("1.0")
//                .build();
//    }

}
